local thbattle__zhengxie_tiaobo = fk.CreateSkill {

  name = "thbattle__zhengxie_tiaobo",

  tags = {},

}



thbattle__zhengxie_tiaobo:addEffect("active", {
  anim_type = "offensive",
  prompt = "#thbattle__zhengxie_tiaobo",
  no_indicate = true,
  target_num = 2,
  target_filter = function(self, player, to_select, selected, selected_cards)
    if to_select ~= player then
      if #selected < 1 then
        return true
      elseif #selected == 1 then
        return selected[1]:canUseTo(Fk:cloneCard("slash"), to_select)
      else
        return false
      end
    end
  end,
  can_use = function(self, player)
    return not player:isKongcheng() and player:usedSkillTimes(thbattle__zhengxie_tiaobo.name, Player.HistoryPhase) == 0
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target1 = effect.tos[1]
    local target2 = effect.tos[2]
    room:doIndicate(effect.from, { effect.tos[1] })
    room:doIndicate(effect.tos[1], { effect.tos[2] })
    local pindian_data = player:pindian({ target1 }, thbattle__zhengxie_tiaobo.name)
    if pindian_data.results[target1].winner == player then
      room:useCard({
        from = target1,
        tos = { target2 },
        card = Fk:cloneCard("danmu__slash"),
      })
    else
      local choice = room:askForChoice(target1, { "#thbattle__zhengxie_tiaobo-slash:" .. player.id, "Cancel" },
        thbattle__zhengxie_tiaobo.name)
      if choice ~= "cancel" then
        room:useCard({
          from = target1,
          tos = { player },
          card = Fk:cloneCard("danmu__slash"),
        })
      end
    end
  end,
})

return thbattle__zhengxie_tiaobo
